package cn.play.cardgame.bean;

import java.util.HashMap;
import java.util.Map;

public class PaiItem {
	private int bouts;
	private String color;
	private String createTime;
	private String currentTime;
	private int id;
	private int isdelete;
	private String machineId;
	private String num;
	private int rounds;
	private int status;
	private String updateTime;

	public int getBouts() {
		return bouts;
	}

	public void setBouts(int bouts) {
		this.bouts = bouts;
	}

	public int getIsdelete() {
		return isdelete;
	}

	public void setIsdelete(int isdelete) {
		this.isdelete = isdelete;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCurrentTime() {
		return currentTime;
	}

	public void setCurrentTime(String currentTime) {
		this.currentTime = currentTime;
	}

	public String getMachineId() {
		return machineId;
	}

	public void setMachineId(String machineId) {
		this.machineId = machineId;
	}

	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		this.num = num;
	}

	public int getRounds() {
		return rounds;
	}

	public void setRounds(int rounds) {
		this.rounds = rounds;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public int getPaiIndex() {
		String value = getPaiValue();
		if (value.equals("j"))
			return 10;
		else if (value.equals("q"))
			return 11;
		else if (value.equals("k"))
			return 12;
		else if (value.equals(""))
			return 13;
		return Integer.valueOf(value) - 1;
	}

	/**
	 *
	 * "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "O"：王
	 *
	 */
	public String getPaiValue() {
		if (num.equals("O"))
			return "";
		else if (num.equals("A"))
			return "1";
		else
			return num.toLowerCase();
	}

	/**
	 * "S"：黑, "C"：梅, "H"：红, "D"：方, "L"：小, "B"：大
	 *
	 */
	public String getPaiHuase() {
//		if (color.equals("S"))
//			return "Heixin";
//		else if (color.equals("C"))
//			return "Caohua";
//		else if (color.equals("H"))
//			return "Hongxin";
//		else if (color.equals("D"))
//			return "Fangkuai";
//		else if (color.equals("B"))
//			return "a";
//		else if (color.equals("L"))
//			return "b";
//		return "";
		return CARD_MAPPING.get(color);
	}

	public PaiItem(String color, String num) {
		super();
		this.color = color;
		this.num = num;
	}

	public PaiItem() {
	}

	private static Map<String, String> CARD_MAPPING;

	static {
		CARD_MAPPING = new HashMap<String, String>();
		CARD_MAPPING.put("S", "Heixin");
		CARD_MAPPING.put("H", "Hongxin");
		CARD_MAPPING.put("C", "Caohua");
		CARD_MAPPING.put("D", "Fangkuai");
		CARD_MAPPING.put("B", "a");
		CARD_MAPPING.put("L", "b");
	}
}
